HW2 - ES18BTECH11016

1. Binary Morphology

1.1 Dilate, Erode, Median

1.1.1 Dilate

Shapes of the window as follws

plaintext
 --------------    ---
|              |    |
|              |    |
|    square    |  (size)
|              |    |
|              |    |
 --------------    ---
      #               ---
     ###               |
    #####              |
   ####### Cross     (size)
    #####              |
     ###               |
      #               ---

1.1.2 Erode

1.1.3 Median

1.2 Verify Duals

1.3 Open, Close

Open = Erode + Dilate Close = Dilate + Erode

1.4 Open-Clos, Clos-Open

1.5 Count pixels in the object of interest in APC


2. Gray Scale Point Operations

2.1 Simple Linear Point Operations

2.2 Full Scale Contrast Stretching

2.3 Log Magnitude Compression

2.4 Gamma Correction

2.5 Histogram Flattening

2. Favorite images from NASA's repository of images


3. Image Zooming

3.1 Nearest Neighbour Interpolation

3.2 Bilinear Interpolation Zooming

Bilinear Interpolation Zooming can be achieved using a simple formula.

plaintext
matrix([
  [1, i0, j0, i0*j0],
  [1, i1, j1, i1*j1],
  [1, i2, j2, i2*j2],
  [1, i3, j3, i3*j3]
]).inverse() * vector([img[i0, j0], img[i1, j1], img[i2, j2], img[i3, j3]])

The resultant vector [A, B, C, D] can be used to find the new pixel value.
new_image[i][j] = A + B*i + C*j + D*i*j

Here, (i0,j0), (i1,j1), (i2,j2), (i3,j3) are the four closest points to (i,j)